<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body style="background: #1C162E;">
    <!-- 为 ECharts 准备一个具备大小（宽高）的 DOM -->
    <div id="main" style="width:730px;height:420px;"></div>
    <script src="../echarts.min.js"></script>
    <script>
        var myCharts = echarts.init(document.querySelector('#main'))
        // 指定图表的配置项和数据
        var option = {
            yAxis: {
                show: false,

            },
            xAxis: [{
                    data: ['星期一', '星期一', '星期一', '星期一', '星期一', '星期一'],
                    splitLine: {
                        show: false
                    },
                    axisLabel: {
                        color: '#504b5e'
                    },
                    axisLine: {
                        show: false
                    },
                    axisTick: {
                        show: false
                    }
                }

            ],

            series: [{
                type: 'bar',
                barWidth: 8,
                itemStyle: {
                    barBorderRadius: 5,
                    color: function (params) {
                        // var colorList = ['#4048EF', '#F15887', '#4048EF', '#4048EF', '#4048EF']
                        var _index = params.dataIndex
                        // return colorList[_index]
                        var colorList = [{
                            top: '#4048EF',
                            bottom: '#5A7BEF'
                        }, {
                            top: '#FE9B86',
                            bottom: '#FE9B86'
                        }, {
                            top: '#FE9B86',
                            bottom: '#FE9B86'
                        }, {
                            top: '#2DC9EB',
                            bottom: '#14D2B8'
                        }, {
                            top: '#fff',
                            bottom: '#fff'
                        }, {
                            top: '#645AFF',
                            bottom: '#A573FF'
                        }]
                        return new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                            offset: 0,
                            color: colorList[_index].top
                        }, {
                            offset: 1,
                            color: colorList[_index].bottom

                        }], false)
                    }
                },
                label: {
                    show: true,
                    position: "top",
                    color: '#fff',
                    formatter: '${c}'
                },
                animationEasing: 'cubicOut',
                data: [1, 3, 4, 5, 6, 6]
            }, ]
        }
        // 使用刚指定的配置项和数据显示图表。
        myCharts.setOption(option);
    </script>
</body>

</html>